import { defHttp } from '/@/utils/http/axios';
import {  WebsiteRecruitModel, WebsiteRecruitTableRecordModel } from '../model/websiteRecruitModel';
import { ErrorMessageMode } from "/#/axios";

enum Api {
  WEBSITERECRUIT_PAGE = '/jxxhWebsite/websiteRecruit/getRecruitVosPage',
  GET_WEBSITERECRUITVO_BY_ID = '/jxxhWebsite/websiteRecruit/',
  WEBSITERECRUITVO_SAVE = '/jxxhWebsite/websiteRecruit/save',
  WEBSITERECRUITVO_UPDATE = '/jxxhWebsite/websiteRecruit/updateById',
  WEBSITERECRUITVO_REMOVE = '/jxxhWebsite/websiteRecruit/logicalRemoveById/',
}

/**
 * @description: Get sample list value
 */

export const websiteRecruitListApi = (params: Object) =>
  defHttp.get<WebsiteRecruitTableRecordModel>(
    {url: Api.WEBSITERECRUIT_PAGE,params },
    { errorMessageMode: 'message' }
  );

export const getWebsiteRecruitVoByIdApi = (id) =>
  defHttp.get<WebsiteRecruitModel>(
    {url: Api.GET_WEBSITERECRUITVO_BY_ID+id },
    { errorMessageMode: 'message' }
  );

export function websiteRecruitSaveApi(params: WebsiteRecruitModel, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<WebsiteRecruitModel>(
    {
      url: Api.WEBSITERECRUITVO_SAVE,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function websiteRecruitUpdateApi(params: WebsiteRecruitModel, mode: ErrorMessageMode = 'modal') {
  return defHttp.put<WebsiteRecruitModel>(
    {
      url: Api.WEBSITERECRUITVO_UPDATE,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export const logicalRemoveById = (id) =>
  defHttp.delete<WebsiteRecruitModel>(
    {url: Api.WEBSITERECRUITVO_REMOVE+id },
    { errorMessageMode: 'message' }
  );
